<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <table id="clazz_subject_strengthdg">
        <thead>
            <tr>
                <th data-options="field:'班级类别'">班级类别</th>
                <th data-options="field:'班级'">班级</th>
                <th data-options="field:'学科',sortable:true">学科</th>
                <th data-options="field:'任课教师',sortable:true">任课教师</th>
                <th data-options="field:'总分',sortable:true">总分</th>
                <th data-options="field:'人数',sortable:true">人数</th>
                <th data-options="field:'人平分',sortable:true">人平分</th>
                <th data-options="field:'特尖人数',sortable:true">特尖人数</th>
                <th data-options="field:'特尖率',sortable:true">特尖率</th>
                <th data-options="field:'特优人数',sortable:true">特优人数</th>
                <th data-options="field:'特优率',sortable:true">特优率</th>
                <th data-options="field:'优秀人数',sortable:true">优秀人数</th>
                <th data-options="field:'优秀率',sortable:true">优秀率</th>
                <th data-options="field:'合格人数',sortable:true">合格人数</th>
                <th data-options="field:'合格率',sortable:true">合格率</th>
                <th data-options="field:'低分人数',sortable:true">低分人数</th>
                <th data-options="field:'低分率',sortable:true">低分率</th>
                <th data-options="field:'最低分',sortable:true">最低分</th>
                <th data-options="field:'实力',sortable:true">实力</th>
                <th data-options="field:'实力排名',sortable:true">实力排名</th>
            </tr>
        </thead>
    </table>
    <div id="clazz_subject_strengthtb">
        <form id="clazz_subject_strengthForm" class="m5">
            <div>
                学期：
                <select class="easyui-combobox" name="termId" id="termId" data-options="width:120,panelHeight:'auto',value:'请选择', editable:false,textField:'学期名称',valueField:'ID',url:'/compent/Util/termList',onSelect:changeTerm"></select>
                <select id="gradeId" class="easyui-combobox" data-options="width:80,panelHeight:'auto', editable:false,url:'/compent/Util/gradeNameList',onSelect:changeGrade"></select>
                <select id="examId" class="easyui-combobox" data-options="width:120,panelHeight:'auto',editable:false,onSelect:changeExam"></select>
                <select id="subject" class="easyui-combobox" data-options="width:60,panelHeight:'auto',editable:false"></select>
                <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="queryOk('clazz_subject_strength')">查询</a>
                <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm1('clazz_subject_strength')">重置</a>
                <a class="easyui-linkbutton" href="javascript:void(0)" data-options="iconCls:'icon-save'" onclick="zoutExcel('clazz_subject_strength','/examScore/clazz_subject_strength')">导出为EXCEL</a>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        $(function(){
            var url = "";
            $("#clazz_subject_strengthdg").datagrid({
                url: "/examScore/clazz_subject_strength/pageQuery.html",
                rownumbers:true,
                striped:true,
                border:false,
                pagination:false,
                fitColumns:true,
                fit:true,
                toolbar: '#clazz_subject_strengthtb',
                rowStyler: function(index,row){
                    if (row.班级 && row.班级.indexOf(99)>0){
                        return 'background-color:#ffc;color:#f00;';
                    }
                }
            })
        })  
        function changeTerm(record){
            var gradeId = $('#gradeId').combobox('getValue');
            loadParam(record.ID,gradeId)
        }
        function changeGrade(record){
            var termId = $('#termId').combobox('getValue');
            loadParam(termId,record.value)
        }
        function changeExam(record) {
            loadSubject(record.value);
        }
        function loadParam(termId,gradeId) {
            if(!gradeId) return;
            var url="/compent/util/getTermExam?termId="+termId+"&grade="+gradeId;
            $('#examId').combobox('setValue','');
            $('#examId').combobox('reload',url);
            var examId = $('#examId').combobox('getValue');
            loadSubject(examId);
        }
        function loadSubject(examId) {
            if(examId) {
                var url="/examScore/clazz_subject_strength/examSubject?examId="+examId;
                $('#subject').combobox('setValue','');
                $('#subject').combobox('reload',url);
            }
        }

        function resetForm1(cf){
            $("#" + cf + "Form")[0].reset();
            $("#" + cf + "Form #termId").combobox('setValue', "请选择");
            $("#" + cf + "Form #gradeId").combobox('setValue', null);
            $("#" + cf + "Form #examId").datebox('setValue', null);
            $("#" + cf + "Form #subject").datebox('setValue', null);
        }
        function queryOk(){
            var examId = $('#examId').combobox('getValue');
            var subject = $('#subject').combobox('getValue');
            if(examId && subject){
                $('#clazz_subject_strengthdg').datagrid('load',{examId:examId,subject:subject});
            }else{
                $.messager.alert('操作提示','请选择考试名称和学科。');
            }
        }
        function zoutExcel(cf, url){
            var examId = $('#examId').combobox('getValue');
            var subject = $('#subject').combobox('getValue');
            if(examId && subject){
                window.location.href = url+"/exportExcel.html?examId=" + examId + "&subject=" + subject;
            }else{
                $.messager.alert('操作提示','请选择考试名称和学科。');
            }
        }
    </script>
</body>
</html>